package com.xdja.testxlog;

public class RabbitQuestion {



static int mounth =1;

public static void main(String args[]) {
        int bigRabbit = 0;
        int middRabbit = 0;
        int smallRabbit = 1;
        int totalTime = 12;
        P(bigRabbit,middRabbit,smallRabbit,totalTime);
    }


public static void P( int bigRabbit,int middRabbit,int smallRabbit,int totalTime){
    if(totalTime<=0){
        System.out.println("无效参数");
        return;
    }
    mounth = mounth+1;
    bigRabbit = bigRabbit+ middRabbit;
    middRabbit = smallRabbit;
    smallRabbit = bigRabbit;
    System.out.println("第"+mounth+"个月");
    System.out.println("bigRabbit"+bigRabbit);
    System.out.println("middRabbit"+middRabbit);
    System.out.println("smallRabbit"+smallRabbit);
    if(mounth<totalTime){
        P(bigRabbit,middRabbit,smallRabbit,totalTime);
    }else {
        int total  =  bigRabbit+middRabbit+smallRabbit;
        System.out.println("1年后有"+total+"对兔子");
    }
}
}

